<?php
include('./connection.php');

//Importacion y creacion de instancia de la clase queries_showImageH.php
$filename = $root_path."db/historia_clinica/include/queries_showImageH.php";
require_once($filename);
$query_showImageH = new Queries_showImageH();

	$id = $_GET['id'];
	$name = trim($_GET['name']);

	//$sql = "SELECT name,content FROM care_historia_adjuntos WHERE id_soap=".$id." AND name='".$name."'";
	$sql = $query_showImageH->select_care_historia_adjuntos($id, $name);

	if (!strcmp("mysql", $dbtype))
        {
            mysql_connect($dbhostname, $dbusername, $dbpassword);
            mysql_select_db($dbname);
            $res = mysql_query($sql);
            $row = mysql_fetch_array($res, MYSQL_ASSOC);
        }
	$nombreC= explode('.',$row['name']);
 	$type = $nombreC[sizeOf($nombreC)-1];
 	$bytes = $row['content'];

	header("Content-type: ".$type);
	print $bytes;
?>
